package com.yulongtian.oneProblemEveryDay.month202212;

import java.util.Arrays;

/**
 * https://leetcode.cn/problems/minimum-number-of-moves-to-seat-everyone/
 * 可
 *
 * @author yulongTian
 * @create 2022-12-31 14:42
 */
public class Test14 {
    public static void main(String[] args) {

    }

    public static int minMovesToSeat(int[] seats, int[] students) {

        Arrays.sort(seats);
        Arrays.sort(students);
        int ans = 0;
        for (int i = 0; i < seats.length; i++) {
            ans += Math.abs(seats[i] - students[i]);
        }


        return ans;
    }
}
